home *** CD-ROM | disk | FTP | other *** search
- /*
- File: TAssistant.h
-
- Contains: Base class implementing an assistant
-
- Written by: Arno Gourdol
-
- Copyright: © 1996 by Apple Computer, Inc., all rights reserved.
-
- */
-
- #pragma once
-
- #ifndef __TASSISTANT__
- #define __TASSISTANT__
-
- #include "CMultiDialogs.h"
- #include "TApplication.h"
-
- enum
- {
- kQuitConfirmationDialog = 129,
- kMaxPane = 100 // Maximum number of panes in an interview
- };
-
- class TAssistant : public CMultiDialog
- {
- public:
- enum
- {
- kCommonPane = 200,
- kConclusionPane = 209,
- kDetailsPane = 210,
-
- kContinueButton = 1,
- kGoBackButton = 2,
- kPaneNumber = 3,
- kBannerBackground = 4,
- kNavbarBackground = 5,
- kHelpCommonItem = 6,
- kLastCommonItem = 6,
-
- kGoAheadButton = kLastCommonItem + 1,
- kCancelButton = kLastCommonItem + 2,
- kShowDetailsButton = kLastCommonItem + 3,
- kHideDetailsButton = kLastCommonItem + 3
- };
-
- // constructor
- TAssistant(SInt16 firstPane,
- SInt16 lastPane,
- TApplication* application = NULL);
-
- // destructor
- virtual ~TAssistant();
-
- // events
- virtual void DrawUserItem(TDrawContext& graphics,
- short item,
- const CRect& frame);
- void DrawBanner(TDrawContext& graphics, const CRect& frame);
- void DrawNavigationBar(TDrawContext& graphics, const CRect& frame);
- virtual void ItemHit(UInt16 pane, short item);
- virtual void GoToNextPane(void);
- virtual void GoToPreviousPane(void);
- virtual void GoToPane(UInt16 paneID);
- virtual Boolean FilterKey(const EventRecord& event, UInt16 key);
-
- // dialog managment
- virtual void PrepareDialog(void);
-
- virtual Boolean CloseRequested(void);
- virtual void Close(void);
-
- // interview
- virtual SInt16 NextPane(SInt16 currentPane); // Given the current pane,
- // returns next pane
- virtual Boolean SkipPane(SInt16 pane); // Return true if pane should be skipped,
- // false if the pane should be displayed
-
- virtual void GoAhead(void); // Function called when the
- // user clicks the to go ahead button
- // in the conclusion pane
-
- protected:
- // Returns the next available pane after currentPane
- SInt16 FindNextPane(SInt16 currentPane);
-
- private:
- TApplication* fApplication; // If this is a stand-alone assistant,
- // application in which it is running
- SInt16 fFirstPane; // ResourceID of the first pane
- SInt16 fLastPane; // ResourceID of the last pane
-
- Boolean fShowDetails; // True if showing details at the
- // conclusion pane
- Str255 fPaneTitle; // Title of the current pane
-
- SInt16 fHistory[kMaxPane]; // Stack of visited panes ID
- UInt16 fHistoryIndex; // Current stack pointer in the history
- // fHistory[fHistoryIndex] is the current pane
- };
-
- #endif
-